package wzc.design_pattern.behaviour.state;

/**
 * @Author 那和不是个啥
 * @Date 2025/7/20
 * @Description
 */

public class NoCoinState implements VendingMachineState {
    private VendingMachine vendingMachine;

    public NoCoinState(VendingMachine vendingMachine) {
        this.vendingMachine = vendingMachine;
    }

    @Override
    public void insertCoin() {
        System.out.println("投币成功！请选择商品。");
        // 转换到有投币状态
        vendingMachine.setCurrentState(new HasCoinState(vendingMachine));
    }

    @Override
    public void ejectCoin() {
        System.out.println("没有投币，无法退币。");
    }

    @Override
    public void pressButton() {
        System.out.println("请先投币。");
    }

    @Override
    public void dispense() {
        System.out.println("请先投币。");
    }
}
